package cn.nawang.ebeim.client.utils;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * Created by GanJc on 2016/1/29.
 */
public class FileUtil {

    public static String md5Hex(String path) {
        String md5 = null;
        FileInputStream in = null;
        try {
            in = new FileInputStream(new File(path));
            md5 = DigestUtils.md5Hex(in);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IOUtils.closeQuietly(in);
        }
        return md5;
    }

}
